-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(php): undiscriminated unions #4783
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Only nits 👏
return attributes; | ||
} | ||
|
||
public getArrayTypeAttributeArgument(type: php.Type): php.AstNode { | ||
public getUnionTypeClassRepresentation(arguments_: php.AstNode[]): ClassInstantiation { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
public getUnionTypeClassRepresentation(arguments_: php.AstNode[]): ClassInstantiation { | |
public getUnionTypeClassInstantiation(arguments_: php.AstNode[]): ClassInstantiation { |
Ideally the argument could be a little more strongly typed (e.g. php.Type
). Otherwise it's possible to write in arbitrary php.CodeBlock
here. But I know it's difficult because of the getTypeAttributeArgument
helper function below - the attributes aren't the same as the type representation (e.g. int
vs integer
).
Fine with this for now, but we'll need to be careful to call this with arguments that make sense.
This PR introduces support in PHP for undiscriminated unions, including the following: